package com.ydl.controller;

import com.ydl.common.util.ResultVo;
import com.ydl.entry.vo.goods.AddGoodsParam;
import com.ydl.entry.vo.goods.DeleteGoodsParam;
import com.ydl.entry.vo.goods.QueryGoodsParam;
import com.ydl.entry.vo.goods.UpdateGoodsParam;
import com.ydl.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/goods")
public class GoodsController {

    @Autowired
    private GoodsService goodsService;


    @PostMapping("/list")
    public ResultVo list(@RequestBody QueryGoodsParam queryGoodsParam) {
        return goodsService.list(queryGoodsParam);
    }

    @PostMapping("add")
    public ResultVo add(@RequestBody AddGoodsParam addGoodsParam) {
        return goodsService.add(addGoodsParam);
    }

    @PostMapping("del")
    public ResultVo del(@RequestBody DeleteGoodsParam deleteGoodsParam) {
        return goodsService.del(deleteGoodsParam);
    }

    @PostMapping("update")
    public ResultVo update(@RequestBody UpdateGoodsParam updateGoodsParam) {
        return goodsService.update(updateGoodsParam);
    }
}
